/**
 * Created by 55456 on 2016/4/8.
 */
var sequelizex = require("../lib/sequelizex");
var shortTypes = sequelizex.DataTypes;
var db = require("./index");
module.exports = (sequelize,DataTypes) => {
    return sequelize.define("UserStory",{
        isLike:shortTypes.Int(-1),

        isCollection:shortTypes.Int(-1)
    },{
        timestamps:false
    })
};

function changeLikeCount(){

}

function validateOwn(us,options){
    return db.models.UserStory.findOne({
        where:{
            storyId:us.storyId,
            isOwn : 1
        }
    }).then(function(result){
        if(result){
            throw("this story has been own by another boy");
        }
    });
}